"""
Author： Mr.Sun
Datetime： 2023/3/27 10:48 
FileName: AH_institutions.py
Desc:  安徽职位筛选
"""
import time
from config.config import UrlRouter as ur
from utils.send_request import SendRequest

BaseUrl = 'http://www.apta.gov.cn'
CityCodeUrl = "http://www.apta.gov.cn/Officer_PositionView/GetPositionRegions?examid=329&_=1679885727933"

city_code = [{
    "Code": "30",
    "Name": "省直"
},
    {
        "Code": "17",
        "Name": "黄山市"
    },
    {
        "Code": "15",
        "Name": "池州市"
    },
    {
        "Code": "14",
        "Name": "铜陵市"
    },
    {
        "Code": "13",
        "Name": "宣城市"
    },
    {
        "Code": "12",
        "Name": "芜湖市"
    },
    {
        "Code": "10",
        "Name": "马鞍山市"
    },
    {
        "Code": "09",
        "Name": "六安市"
    },
    {
        "Code": "08",
        "Name": "滁州市"
    },
    {
        "Code": "06",
        "Name": "阜阳市"
    },
    {
        "Code": "05",
        "Name": "蚌埠市"
    },
    {
        "Code": "04",
        "Name": "宿州市"
    }]


# 被拦截，但是接口没问题
def get_city_code():
    url = ur.ah['base'] + ur.ah['city_code'] + "?examid=329&_=" + str(int(time.time())) + '000'
    headers = {
        "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36"
    }
    print(url)
    response = SendRequest(url, headers=headers).GetRequest()
    print(response)


def get_information():
    print(1)


if __name__ == '__main__':
    get_city_code()
